import request from './request'

// 获取指定ID的报名记录
export const getRegistrationApi = id => request.get(`/lecture-registrations/${id}`)

// 分页获取讲座的报名记录
export const getRegistrationsByLectureApi = (lectureId, pageNum = 1, pageSize = 10) => request.get('/lecture-registrations/page', {
    params: { lectureId, pageNum, pageSize }
})

// 获取当前用户的报名记录列表
export const getCurrentUserRegistrationsApi = () => request.get('/lecture-registrations/current')

// 报名讲座
export const registerLectureApi = lectureId => request.post(`/lecture-registrations/${lectureId}`)

// 取消报名
export const cancelRegistrationApi = lectureId => request.post(`/lecture-registrations/${lectureId}/cancel`)

// 标记为已参加
export const markAsAttendedApi = lectureId => request.post(`/lecture-registrations/${lectureId}/attend`)

// 提交反馈
export const submitFeedbackApi = (lectureId, feedback, rating) => request.post(`/lecture-registrations/${lectureId}/feedback`, null, {
    params: { feedback, rating }
})

// 检查是否已报名
export const checkRegistrationApi = lectureId => request.get(`/lecture-registrations/${lectureId}/check`) 